package com.ec.common.constant;

/**
 * @description: redis redis缓存key常量
 * @author: Eric Lee
 * @time: 2021/5/25 16:01
 */
public class RedisKeyConstant {
    /**
     * redis key 命名规范：
     * <服务名称>:<业务类型>:<唯一值KEY>:<唯一值VALUE>
     */
    private static final String GLOBAL_KEY_PREFIX = "global:";
    private static final String AUTH_KEY_PREFIX = "auth:";
    private static final String  LOG_KEY_PREFIX = "log:";
    private static final String  SYSTEM_KEY_PREFIX = "system:";
    private static final String  FILE_KEY_PREFIX = "file:";

    public static class Global {
        /**
         * 12小时，单位毫秒
         */
        public static final Long TOKEN_EXPIRE = 12 * 3600 * 1000L;
        /**
         * token存放位置
         */
        public static final String TOKEN_KEY = GLOBAL_KEY_PREFIX + "token:%s";
        /**
         * IP
         */
        public static final String USER_IP_KEY = GLOBAL_KEY_PREFIX + "ip:%s";
    }


    public static class UserLogin {
        /**
         * 验证码存放位置
         */
        public static final String CAPTCHA_KEY = AUTH_KEY_PREFIX + "userLogin:captcha:%s";
    }
}
